/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package post2;
import java.util.*;

/**
 *
 * @author Danny
 */
public class Stock {
    Hashtable <String, TransactionItem> stock;
    
    public Stock(){
        stock = new Hashtable<String, TransactionItem>();
    }
    
    void addToStock(String upcKey, TransactionItem value){
        stock.put(upcKey, value);
    }
    
    TransactionItem getItem(String upc){
        return stock.get(upc);
    }
    
    boolean hasItem(String upc){
        return stock.containsKey(upc);
    }
    
    Enumeration getAllUPC(){
        return stock.keys();
    }
    
    Collection getAllItem(){
        return stock.values();
    }
    
}
